package hasthi.decision.planning;

import hasthi.actuators.ActionContext;
import hasthi.actuators.CreateServiceAction;
import hasthi.actuators.ManagementAction;
import hasthi.actuators.actions.ActionCallback;
import hasthi.common.HasthiException;
import hasthi.decision.planning.SimplePlanner.EndpointDetails;
import hasthi.metamodel.resource.ManagedResource;

import java.util.List;
import java.util.Vector;

import javax.xml.namespace.QName;

public interface Planner {
    public void init(ActionContext actionContext)throws HasthiException;
    public abstract List<ManagementAction> planActions(List<ManagementAction> actions)
            throws HasthiException;

    //public abstract List<ManagementAction> resolveConflicts(List<ManagementAction> actions);

    public abstract void actionCompleted(ManagementAction action);

    public abstract void actionFailed(ManagementAction action, Throwable e);
    
    public void actionActive(ManagementAction action);
    public void actionSceduled(ManagementAction action);
    
    public List<EndpointDetails> getServiceEndpointsByName(QName serviceType,
            ActionCallback callback2CallWhenPendingActionFinishes);
    
    /**
     * @param serviceType
     * @return return true if an endpoint of give service type exists or being created
     */
    
    public boolean isEndpointsExistsByName(QName serviceType)throws HasthiException;
    
    /**
     * Given a service type, this method returns all service types this service depends on.
     * They are decided by parsing service profiles. 
     * @param serviceType
     * @return
     * @throws HasthiException
     */
    public List<QName> getDependancyList(QName serviceType) throws HasthiException;
    
    /**
     * Given a service type, this method returns all missing service types this service depends on.
     * They are decided by parsing service profiles - active services. 
     * @param serviceType
     * @return
     * @throws HasthiException
     */
    public List<QName> getMissingDependancyList(QName serviceType) throws HasthiException;

}